package p270jp.pxv.android.activity;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.Spinner;
import android.widget.TextView;
import androidx.appcompat.app.AlertController;
import androidx.appcompat.app.AlertDialog;
import com.google.android.material.appbar.MaterialToolbar;
import com.google.android.material.textfield.TextInputEditText;
import com.google.android.material.textfield.TextInputLayout;
import java.io.File;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.Locale;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import net.pixiv.charcoal.android.view.button.CharcoalButton;
import p005a5.C0022b;
import p014ae.AbstractActivityC0166u2;
import p014ae.C0048a7;
import p014ae.C0146r;
import p014ae.C0147r4;
import p014ae.C0168u5;
import p014ae.C0172v6;
import p014ae.C0180w6;
import p014ae.C0183x6;
import p014ae.C0192y6;
import p014ae.C0201z6;
import p014ae.DialogInterface$OnClickListenerC0085g5;
import p014ae.View$OnClickListenerC0046a;
import p014ae.View$OnClickListenerC0050b;
import p014ae.View$OnClickListenerC0054c;
import p016ag.PixivAppApiErrorMapper;
import p041ba.C1048a;
import p046bf.PixivAppApiClient;
import p047bg.C1124a;
import p056bp.LocalDate;
import p062c4.ViewBindings;
import p071cd.Functions;
import p090d0.C2518n;
import p109dj.OnTextChangedListener;
import p134ei.AnalyticsScreenName;
import p165fo.Subscribe;
import p179gc.ViewClickObservable;
import p187gl.PixivRequest;
import p210hh.PixivAccountManager;
import p232id.ObservableThrottleFirstTimed;
import p258jd.SingleFlatMap;
import p270jp.pxv.android.R;
import p270jp.pxv.android.event.DatePickerEvent;
import p270jp.pxv.android.legacy.view.InfoOverlayView;
import p270jp.pxv.android.model.PixivAddressPreset;
import p270jp.pxv.android.model.PixivProfile;
import p270jp.pxv.android.model.PixivProfilePresets;
import p270jp.pxv.android.model.ProfileEditParameter;
import p270jp.pxv.android.view.SettingPublicityButton;
import p314lg.ActivityProfileEditBinding;
import p325m0.MutabilityOwnership;
import p343mi.FileProviderService;
import p350mp.Timber;
import p370ni.InfoType;
import p381o3.C5429d;
import p393of.C5453b;
import p422ph.C5584l;
import p422ph.C5585m;
import p422ph.CameraService;
import p436q6.C5768b;
import p491sd.C6034a;
import p547uh.DatePickerDialogFragment;
import p569vd.C6830b;
import p593wc.AbstractC6902j;
import p593wc.AbstractC6904o;
import p593wc.Single;
import p603wm.AbstractC6949c;
import p639y6.C7292h;
import p639y6.C7296l;
import p645yc.AndroidSchedulers;
import p671zc.CompositeDisposable;
import p677zi.PixivImageLoader;

/* renamed from: jp.pxv.android.activity.ProfileEditActivity */
/* loaded from: classes2.dex */
public final class ProfileEditActivity extends AbstractActivityC0166u2 {

    /* renamed from: a0 */
    public static final /* synthetic */ int f18539a0 = 0;

    /* renamed from: J */
    public AbstractC6949c<CameraService> f18541J;

    /* renamed from: K */
    public AbstractC6949c<C5585m> f18542K;

    /* renamed from: L */
    public AbstractC6949c<FileProviderService> f18543L;

    /* renamed from: M */
    public AbstractC6949c<PixivImageLoader> f18544M;

    /* renamed from: N */
    public PixivProfile f18545N;

    /* renamed from: O */
    public PixivProfilePresets f18546O;

    /* renamed from: R */
    public File f18549R;

    /* renamed from: Y */
    public ActivityProfileEditBinding f18550Y;

    /* renamed from: Z */
    public PixivAppApiErrorMapper f18551Z;

    /* renamed from: I */
    public CompositeDisposable f18540I = new CompositeDisposable();

    /* renamed from: P */
    public ProfileEditParameter f18547P = new ProfileEditParameter();

    /* renamed from: Q */
    public ProfileEditParameter f18548Q = new ProfileEditParameter();

    /* renamed from: jp.pxv.android.activity.ProfileEditActivity$a */
    /* loaded from: classes2.dex */
    public class C4065a extends OnTextChangedListener {
        public C4065a() {
        }

        @Override // p109dj.OnTextChangedListener, android.text.TextWatcher
        public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
            ProfileEditActivity.this.f18548Q.nickName = charSequence.toString();
            ProfileEditActivity.this.m4761Z0();
        }
    }

    /* renamed from: jp.pxv.android.activity.ProfileEditActivity$b */
    /* loaded from: classes2.dex */
    public class C4066b extends OnTextChangedListener {
        public C4066b() {
        }

        @Override // p109dj.OnTextChangedListener, android.text.TextWatcher
        public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
            ProfileEditActivity.this.f18548Q.webpage = charSequence.toString();
            ProfileEditActivity.this.m4761Z0();
        }
    }

    /* renamed from: jp.pxv.android.activity.ProfileEditActivity$c */
    /* loaded from: classes2.dex */
    public class C4067c extends OnTextChangedListener {
        public C4067c() {
        }

        @Override // p109dj.OnTextChangedListener, android.text.TextWatcher
        public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
            ProfileEditActivity.this.f18548Q.comment = charSequence.toString();
            ProfileEditActivity.this.m4761Z0();
        }
    }

    /* renamed from: jp.pxv.android.activity.ProfileEditActivity$d */
    /* loaded from: classes2.dex */
    public class C4068d extends OnTextChangedListener {
        public C4068d() {
        }

        @Override // p109dj.OnTextChangedListener, android.text.TextWatcher
        public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
            ProfileEditActivity.this.f18548Q.twitterAccount = charSequence.toString();
            ProfileEditActivity.this.m4761Z0();
        }
    }

    /* renamed from: jp.pxv.android.activity.ProfileEditActivity$e */
    /* loaded from: classes2.dex */
    public class C4069e implements AdapterView.OnItemSelectedListener {
        public C4069e() {
        }

        @Override // android.widget.AdapterView.OnItemSelectedListener
        public void onItemSelected(AdapterView<?> adapterView, View view, int i, long j) {
            ProfileEditActivity.this.f18548Q.gender = ProfileEditParameter.Gender.values()[i];
            ProfileEditActivity.this.m4761Z0();
        }

        @Override // android.widget.AdapterView.OnItemSelectedListener
        public void onNothingSelected(AdapterView<?> adapterView) {
        }
    }

    /* renamed from: jp.pxv.android.activity.ProfileEditActivity$f */
    /* loaded from: classes2.dex */
    public class C4070f implements AdapterView.OnItemSelectedListener {
        public C4070f() {
        }

        @Override // android.widget.AdapterView.OnItemSelectedListener
        public void onItemSelected(AdapterView<?> adapterView, View view, int i, long j) {
            if (i == 0) {
                ProfileEditActivity profileEditActivity = ProfileEditActivity.this;
                profileEditActivity.f18548Q.addressId = 0;
                profileEditActivity.f18550Y.f21473i.setVisibility(8);
            } else {
                PixivAddressPreset pixivAddressPreset = ProfileEditActivity.this.f18546O.addresses.get(i - 1);
                ProfileEditActivity profileEditActivity2 = ProfileEditActivity.this;
                profileEditActivity2.f18548Q.addressId = pixivAddressPreset.f19130id;
                if (pixivAddressPreset.isGlobal) {
                    profileEditActivity2.f18550Y.f21473i.setVisibility(0);
                } else {
                    profileEditActivity2.f18550Y.f21473i.setVisibility(8);
                }
            }
            ProfileEditActivity profileEditActivity3 = ProfileEditActivity.this;
            int i2 = ProfileEditActivity.f18539a0;
            profileEditActivity3.m4761Z0();
        }

        @Override // android.widget.AdapterView.OnItemSelectedListener
        public void onNothingSelected(AdapterView<?> adapterView) {
        }
    }

    /* renamed from: jp.pxv.android.activity.ProfileEditActivity$g */
    /* loaded from: classes2.dex */
    public class C4071g implements AdapterView.OnItemSelectedListener {
        public C4071g() {
        }

        @Override // android.widget.AdapterView.OnItemSelectedListener
        public void onItemSelected(AdapterView<?> adapterView, View view, int i, long j) {
            if (i == 0) {
                ProfileEditActivity.this.f18548Q.countryCode = "";
            } else {
                ProfileEditActivity profileEditActivity = ProfileEditActivity.this;
                profileEditActivity.f18548Q.countryCode = profileEditActivity.f18546O.countries.get(i - 1).code;
            }
            ProfileEditActivity profileEditActivity2 = ProfileEditActivity.this;
            int i2 = ProfileEditActivity.f18539a0;
            profileEditActivity2.m4761Z0();
        }

        @Override // android.widget.AdapterView.OnItemSelectedListener
        public void onNothingSelected(AdapterView<?> adapterView) {
        }
    }

    /* renamed from: jp.pxv.android.activity.ProfileEditActivity$h */
    /* loaded from: classes2.dex */
    public class C4072h implements AdapterView.OnItemSelectedListener {
        public C4072h() {
        }

        @Override // android.widget.AdapterView.OnItemSelectedListener
        public void onItemSelected(AdapterView<?> adapterView, View view, int i, long j) {
            if (i == 0) {
                ProfileEditActivity.this.f18548Q.jobId = 0;
            } else {
                ProfileEditActivity profileEditActivity = ProfileEditActivity.this;
                profileEditActivity.f18548Q.jobId = profileEditActivity.f18546O.jobs.get(i - 1).f19132id;
            }
            ProfileEditActivity profileEditActivity2 = ProfileEditActivity.this;
            int i2 = ProfileEditActivity.f18539a0;
            profileEditActivity2.m4761Z0();
        }

        @Override // android.widget.AdapterView.OnItemSelectedListener
        public void onNothingSelected(AdapterView<?> adapterView) {
        }
    }

    /* renamed from: jp.pxv.android.activity.ProfileEditActivity$i */
    /* loaded from: classes2.dex */
    public static /* synthetic */ class C4073i {

        /* renamed from: a */
        public static final /* synthetic */ int[] f18560a;

        static {
            int[] iArr = new int[ProfileEditParameter.Gender.values().length];
            f18560a = iArr;
            try {
                iArr[ProfileEditParameter.Gender.MALE.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                f18560a[ProfileEditParameter.Gender.FEMALE.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                f18560a[ProfileEditParameter.Gender.UNKNOWN.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
        }
    }

    @SuppressLint({"MissingPermission"})
    /* renamed from: V0 */
    public final Single<File> m4765V0(Uri uri) {
        C5585m value = this.f18542K.getValue();
        Objects.requireNonNull(value);
        return C0022b.m12182y(null, new C5584l(value, "", null), 1).m970f(new C5429d(value, uri, 2));
    }

    /* renamed from: W0 */
    public final void m4764W0() {
        this.f18550Y.f21476l.m4595d(InfoType.LOADING, null);
        this.f18540I.mo82c(AbstractC6902j.m980u(PixivRequest.m5805l(PixivAccountManager.m5511e().f16499e), PixivAppApiClient.m10323a().m10318C(), C0172v6.f627a).m986o(AndroidSchedulers.m334a()).m984q(new C0146r(this, 2), new C0192y6(this, 1), Functions.f5386c, Functions.f5387d));
    }

    /* renamed from: X0 */
    public final void m4763X0(Single<File> pVar) {
        this.f18540I.mo82c(pVar.m961o(C6034a.f26179d).m966j(AndroidSchedulers.m334a()).m963m(new C0183x6(this, 1), new C6830b(this, 3)));
    }

    /* renamed from: Y0 */
    public final void m4762Y0() {
        this.f18550Y.f21479o.setText(this.f18548Q.nickName);
        this.f18550Y.f21488x.setText(this.f18548Q.webpage);
        this.f18550Y.f21486v.setText(this.f18548Q.twitterAccount);
        this.f18550Y.f21472h.setText(this.f18548Q.comment);
        int i = C4073i.f18560a[this.f18548Q.gender.ordinal()];
        if (i == 1) {
            this.f18550Y.f21475k.setSelection(1);
        } else if (i == 2) {
            this.f18550Y.f21475k.setSelection(2);
        } else if (i == 3) {
            this.f18550Y.f21475k.setSelection(0);
        }
        this.f18550Y.f21466b.setSelection(this.f18548Q.addressId);
        if (!TextUtils.isEmpty(this.f18548Q.countryCode)) {
            int i2 = 0;
            while (true) {
                if (i2 >= this.f18546O.countries.size()) {
                    break;
                } else if (this.f18546O.countries.get(i2).code.equals(this.f18548Q.countryCode)) {
                    this.f18550Y.f21473i.setSelection(i2 + 1);
                    break;
                } else {
                    i2++;
                }
            }
        } else {
            this.f18550Y.f21473i.setSelection(0);
        }
        if (!TextUtils.isEmpty(this.f18548Q.birthDay)) {
            this.f18550Y.f21468d.setText(this.f18548Q.birthDay);
        } else {
            this.f18550Y.f21468d.setText(getString(R.string.signup_profile_unselected));
        }
        if (this.f18548Q.birthYear != 0) {
            this.f18550Y.f21471g.setText(String.format(Locale.getDefault(), "%4d", Integer.valueOf(this.f18548Q.birthYear)));
        } else {
            this.f18550Y.f21471g.setText(getString(R.string.signup_profile_unselected));
        }
        this.f18550Y.f21478n.setSelection(this.f18548Q.jobId);
        this.f18550Y.f21474j.setPublicity(this.f18548Q.genderPublicity);
        this.f18550Y.f21484t.setPublicity(this.f18548Q.regionPublicity);
        this.f18550Y.f21470f.setPublicity(this.f18548Q.birthYearPublicity);
        this.f18550Y.f21467c.setPublicity(this.f18548Q.birthDayPublicity);
        this.f18550Y.f21477m.setPublicity(this.f18548Q.jobPublicity);
    }

    /* renamed from: Z0 */
    public final void m4761Z0() {
        this.f18550Y.f21483s.setEnabled(!this.f18548Q.equals(this.f18547P) && !TextUtils.isEmpty(this.f18550Y.f21479o.getText().toString()));
    }

    @Override // androidx.fragment.app.FragmentActivity, androidx.activity.ComponentActivity, android.app.Activity
    public void onActivityResult(int i, int i2, Intent intent) {
        super.onActivityResult(i, i2, intent);
        if (i2 != -1 || i != 1) {
            return;
        }
        if (intent == null || intent.getData() == null) {
            m4763X0(new SingleFlatMap(this.f18541J.getValue().m3023b(this.f18549R), new C0201z6(this)));
            this.f18549R = null;
        } else if (intent.getData() != null) {
            m4763X0(m4765V0(intent.getData()));
        } else {
            Timber.f23100a.mo3515o("プロフィール画像選択後に想定外のデータが渡ってきています", new Object[0]);
        }
    }

    public void onClickBirthDayTextView(View view) {
        Calendar instance = Calendar.getInstance();
        int i = instance.get(1);
        if (!TextUtils.isEmpty(this.f18548Q.birthDay)) {
            try {
                instance.setTime(new SimpleDateFormat("MM-dd", Locale.getDefault()).parse(this.f18548Q.birthDay));
            } catch (ParseException e) {
                Timber.f23100a.mo3514p(e);
            }
        }
        int i2 = this.f18548Q.birthYear;
        if (i2 != 0) {
            instance.set(1, i2);
        } else {
            instance.set(1, i - 20);
        }
        DatePickerDialogFragment.m1661f(instance.get(1), instance.get(2), instance.get(5), new GregorianCalendar(1920, 0, 1).getTimeInMillis(), new GregorianCalendar(i - 8, 11, 31).getTimeInMillis(), 1).show(m11131K0(), "date_picker");
    }

    public void onClickProfileImageView(View view) {
        boolean z = this.f18545N.isUsingCustomProfileImage;
        if ((z || this.f18548Q.profileImagePath != null) && (!z || !this.f18548Q.deleteProfileImage)) {
            CharSequence[] charSequenceArr = {getString(R.string.settings_profile_image_select), getString(R.string.settings_profile_image_delete)};
            AlertDialog.C0305a aVar = new AlertDialog.C0305a(this);
            aVar.m12006h(R.string.settings_profile_image);
            DialogInterface$OnClickListenerC0085g5 g5Var = new DialogInterface$OnClickListenerC0085g5(this, 1);
            AlertController.C0299b bVar = aVar.f1085a;
            bVar.f1066p = charSequenceArr;
            bVar.f1068r = g5Var;
            aVar.m12013a().show();
            return;
        }
        m4678T0(new String[]{"android.permission.READ_EXTERNAL_STORAGE", "android.permission.WRITE_EXTERNAL_STORAGE"}, new C0048a7(this));
    }

    public void onClickReflectButton(View view) {
        C5453b.m3264m(this);
        ProfileEditParameter profileEditParameter = this.f18548Q;
        this.f18550Y.f21483s.setEnabled(false);
        this.f18540I.mo82c(PixivAccountManager.m5511e().m5514b().m989l(new C7296l(profileEditParameter, 24)).m986o(AndroidSchedulers.m334a()).m984q(new C0168u5(this, profileEditParameter, 1), new C0147r4(this, 2), Functions.f5386c, Functions.f5387d));
    }

    @Override // p270jp.pxv.android.activity.BaseActivity, androidx.fragment.app.FragmentActivity, androidx.activity.ComponentActivity, p248j2.ActivityC3902g, android.app.Activity
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        View inflate = getLayoutInflater().inflate(R.layout.activity_profile_edit, (ViewGroup) null, false);
        int i = R.id.address_spinner;
        Spinner spinner = (Spinner) ViewBindings.m9835b(inflate, R.id.address_spinner);
        if (spinner != null) {
            i = R.id.birth_day_publicity_button;
            SettingPublicityButton settingPublicityButton = (SettingPublicityButton) ViewBindings.m9835b(inflate, R.id.birth_day_publicity_button);
            if (settingPublicityButton != null) {
                i = R.id.birth_day_text_view;
                TextView textView = (TextView) ViewBindings.m9835b(inflate, R.id.birth_day_text_view);
                if (textView != null) {
                    i = R.id.birth_error_text_view;
                    TextView textView2 = (TextView) ViewBindings.m9835b(inflate, R.id.birth_error_text_view);
                    if (textView2 != null) {
                        i = R.id.birth_year_publicity_button;
                        SettingPublicityButton settingPublicityButton2 = (SettingPublicityButton) ViewBindings.m9835b(inflate, R.id.birth_year_publicity_button);
                        if (settingPublicityButton2 != null) {
                            i = R.id.birth_year_text_view;
                            TextView textView3 = (TextView) ViewBindings.m9835b(inflate, R.id.birth_year_text_view);
                            if (textView3 != null) {
                                i = R.id.comment_edit_text;
                                TextInputEditText textInputEditText = (TextInputEditText) ViewBindings.m9835b(inflate, R.id.comment_edit_text);
                                if (textInputEditText != null) {
                                    i = R.id.country_spinner;
                                    Spinner spinner2 = (Spinner) ViewBindings.m9835b(inflate, R.id.country_spinner);
                                    if (spinner2 != null) {
                                        i = R.id.gender_publicity_button;
                                        SettingPublicityButton settingPublicityButton3 = (SettingPublicityButton) ViewBindings.m9835b(inflate, R.id.gender_publicity_button);
                                        if (settingPublicityButton3 != null) {
                                            i = R.id.gender_spinner;
                                            Spinner spinner3 = (Spinner) ViewBindings.m9835b(inflate, R.id.gender_spinner);
                                            if (spinner3 != null) {
                                                i = R.id.info_overlay_view;
                                                InfoOverlayView infoOverlayView = (InfoOverlayView) ViewBindings.m9835b(inflate, R.id.info_overlay_view);
                                                if (infoOverlayView != null) {
                                                    i = R.id.input_container_linear_layout;
                                                    LinearLayout linearLayout = (LinearLayout) ViewBindings.m9835b(inflate, R.id.input_container_linear_layout);
                                                    if (linearLayout != null) {
                                                        i = R.id.job_error_text_view;
                                                        TextView textView4 = (TextView) ViewBindings.m9835b(inflate, R.id.job_error_text_view);
                                                        if (textView4 != null) {
                                                            i = R.id.job_publicity_button;
                                                            SettingPublicityButton settingPublicityButton4 = (SettingPublicityButton) ViewBindings.m9835b(inflate, R.id.job_publicity_button);
                                                            if (settingPublicityButton4 != null) {
                                                                i = R.id.job_spinner;
                                                                Spinner spinner4 = (Spinner) ViewBindings.m9835b(inflate, R.id.job_spinner);
                                                                if (spinner4 != null) {
                                                                    i = R.id.nick_name_edit_text;
                                                                    TextInputEditText textInputEditText2 = (TextInputEditText) ViewBindings.m9835b(inflate, R.id.nick_name_edit_text);
                                                                    if (textInputEditText2 != null) {
                                                                        i = R.id.nick_name_text_input_layout;
                                                                        TextInputLayout textInputLayout = (TextInputLayout) ViewBindings.m9835b(inflate, R.id.nick_name_text_input_layout);
                                                                        if (textInputLayout != null) {
                                                                            i = R.id.profile_image_error_text_view;
                                                                            TextView textView5 = (TextView) ViewBindings.m9835b(inflate, R.id.profile_image_error_text_view);
                                                                            if (textView5 != null) {
                                                                                i = R.id.profile_image_view;
                                                                                ImageView imageView = (ImageView) ViewBindings.m9835b(inflate, R.id.profile_image_view);
                                                                                if (imageView != null) {
                                                                                    i = R.id.reflect_button;
                                                                                    CharcoalButton charcoalButton = (CharcoalButton) ViewBindings.m9835b(inflate, R.id.reflect_button);
                                                                                    if (charcoalButton != null) {
                                                                                        i = R.id.region_publicity_button;
                                                                                        SettingPublicityButton settingPublicityButton5 = (SettingPublicityButton) ViewBindings.m9835b(inflate, R.id.region_publicity_button);
                                                                                        if (settingPublicityButton5 != null) {
                                                                                            i = R.id.tool_bar;
                                                                                            MaterialToolbar materialToolbar = (MaterialToolbar) ViewBindings.m9835b(inflate, R.id.tool_bar);
                                                                                            if (materialToolbar != null) {
                                                                                                i = R.id.twitter_account_edit_text;
                                                                                                TextInputEditText textInputEditText3 = (TextInputEditText) ViewBindings.m9835b(inflate, R.id.twitter_account_edit_text);
                                                                                                if (textInputEditText3 != null) {
                                                                                                    i = R.id.twitter_account_text_input_layout;
                                                                                                    TextInputLayout textInputLayout2 = (TextInputLayout) ViewBindings.m9835b(inflate, R.id.twitter_account_text_input_layout);
                                                                                                    if (textInputLayout2 != null) {
                                                                                                        i = R.id.webpage_edit_text;
                                                                                                        TextInputEditText textInputEditText4 = (TextInputEditText) ViewBindings.m9835b(inflate, R.id.webpage_edit_text);
                                                                                                        if (textInputEditText4 != null) {
                                                                                                            i = R.id.webpage_text_input_layout;
                                                                                                            TextInputLayout textInputLayout3 = (TextInputLayout) ViewBindings.m9835b(inflate, R.id.webpage_text_input_layout);
                                                                                                            if (textInputLayout3 != null) {
                                                                                                                RelativeLayout relativeLayout = (RelativeLayout) inflate;
                                                                                                                this.f18550Y = new ActivityProfileEditBinding(relativeLayout, spinner, settingPublicityButton, textView, textView2, settingPublicityButton2, textView3, textInputEditText, spinner2, settingPublicityButton3, spinner3, infoOverlayView, linearLayout, textView4, settingPublicityButton4, spinner4, textInputEditText2, textInputLayout, textView5, imageView, charcoalButton, settingPublicityButton5, materialToolbar, textInputEditText3, textInputLayout2, textInputEditText4, textInputLayout3);
                                                                                                                setContentView(relativeLayout);
                                                                                                                this.f18551Z = (PixivAppApiErrorMapper) C2518n.m7641d(PixivAppApiErrorMapper.class);
                                                                                                                this.f18541J = C2518n.m7638h(CameraService.class);
                                                                                                                this.f18543L = C2518n.m7638h(FileProviderService.class);
                                                                                                                this.f18542K = C2518n.m7638h(C5585m.class);
                                                                                                                this.f18544M = C2518n.m7638h(PixivImageLoader.class);
                                                                                                                this.f18757A.m6525e(AnalyticsScreenName.PROFILE_SETTINGS);
                                                                                                                C1124a.m10197Q(this, this.f18550Y.f21485u, R.string.settings_profile);
                                                                                                                if (bundle != null) {
                                                                                                                    this.f18549R = (File) bundle.getSerializable("saved_key_profile_picture_file");
                                                                                                                }
                                                                                                                this.f18550Y.f21474j.setOnPublicityChangedListener(new C0048a7(this));
                                                                                                                this.f18550Y.f21484t.setOnPublicityChangedListener(new C0201z6(this));
                                                                                                                this.f18550Y.f21470f.setOnPublicityChangedListener(new C5768b(this, 12));
                                                                                                                this.f18550Y.f21467c.setOnPublicityChangedListener(new C1048a(this, 4));
                                                                                                                this.f18550Y.f21477m.setOnPublicityChangedListener(new C7292h(this, 6));
                                                                                                                m4764W0();
                                                                                                                this.f18550Y.f21479o.addTextChangedListener(new C4065a());
                                                                                                                this.f18550Y.f21488x.addTextChangedListener(new C4066b());
                                                                                                                this.f18550Y.f21472h.addTextChangedListener(new C4067c());
                                                                                                                this.f18550Y.f21486v.addTextChangedListener(new C4068d());
                                                                                                                this.f18550Y.f21475k.setOnItemSelectedListener(new C4069e());
                                                                                                                this.f18550Y.f21466b.setOnItemSelectedListener(new C4070f());
                                                                                                                this.f18550Y.f21473i.setOnItemSelectedListener(new C4071g());
                                                                                                                this.f18550Y.f21478n.setOnItemSelectedListener(new C4072h());
                                                                                                                ImageView imageView2 = this.f18550Y.f21482r;
                                                                                                                MutabilityOwnership.m3745m(imageView2, "<this>");
                                                                                                                ViewClickObservable aVar = new ViewClickObservable(imageView2);
                                                                                                                TimeUnit timeUnit = TimeUnit.MILLISECONDS;
                                                                                                                AbstractC6904o oVar = C6034a.f26177b;
                                                                                                                Objects.requireNonNull(timeUnit, "unit is null");
                                                                                                                Objects.requireNonNull(oVar, "scheduler is null");
                                                                                                                this.f18540I.mo82c(new ObservableThrottleFirstTimed(aVar, 300, timeUnit, oVar).m986o(AndroidSchedulers.m334a()).m984q(new C0180w6(this, 0), Functions.f5388e, Functions.f5386c, Functions.f5387d));
                                                                                                                this.f18550Y.f21471g.setOnClickListener(new View$OnClickListenerC0050b(this, 7));
                                                                                                                this.f18550Y.f21468d.setOnClickListener(new View$OnClickListenerC0046a(this, 5));
                                                                                                                this.f18550Y.f21483s.setOnClickListener(new View$OnClickListenerC0054c(this, 5));
                                                                                                                return;
                                                                                                            }
                                                                                                        }
                                                                                                    }
                                                                                                }
                                                                                            }
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        throw new NullPointerException("Missing required view with ID: ".concat(inflate.getResources().getResourceName(i)));
    }

    @Override // p270jp.pxv.android.activity.BaseActivity, p116e.ActivityC2727f, androidx.fragment.app.FragmentActivity, android.app.Activity
    public void onDestroy() {
        this.f18540I.m80f();
        super.onDestroy();
    }

    @Subscribe
    public void onEvent(DatePickerEvent datePickerEvent) {
        if (datePickerEvent.getRequestCode() != 1) {
            Timber.f23100a.mo3515o("Receive unintended request code: %s", Integer.valueOf(datePickerEvent.getRequestCode()));
            return;
        }
        LocalDate localDate = datePickerEvent.getLocalDate();
        int i = localDate.f5073b;
        short s = localDate.f5074c;
        short s2 = localDate.f5075d;
        ProfileEditParameter profileEditParameter = this.f18548Q;
        profileEditParameter.birthYear = i;
        profileEditParameter.birthDay = String.format(Locale.getDefault(), "%02d-%02d", Integer.valueOf(s), Integer.valueOf(s2));
        m4762Y0();
        m4761Z0();
    }

    @Override // androidx.activity.ComponentActivity, android.app.Activity
    public boolean onOptionsItemSelected(MenuItem menuItem) {
        if (menuItem.getItemId() != 16908332) {
            return super.onOptionsItemSelected(menuItem);
        }
        this.f940i.m12030b();
        return true;
    }

    @Override // p270jp.pxv.android.activity.BaseActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
    public void onPause() {
        View currentFocus = getCurrentFocus();
        if (currentFocus != null) {
            currentFocus.clearFocus();
        }
        super.onPause();
    }

    @Override // androidx.activity.ComponentActivity, p248j2.ActivityC3902g, android.app.Activity
    public void onSaveInstanceState(Bundle bundle) {
        super.onSaveInstanceState(bundle);
        bundle.putSerializable("saved_key_profile_picture_file", this.f18549R);
    }
}
